package com.yuexunit.auth.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.yuexunit.account.action.v2.model.Operation;
import com.yuexunit.persist.annotation.Cacheable;


/**
 * @author wangjinshui
 */
@Entity
@Table(name="AC_OPERATION")
@Cacheable(maxCount=5000, timeToIdleSeconds=36000)
public class OperationEntity {
	@Id
	@Column(name="OPERATION_CODE")
	private String operationCode;

	@Column(name="APP_UUID")
	private String appUuid;
	
	@Column(name="OPERATION_NAME")
	private String operationName;

	@Column(name="CREATE_DT")
	private Date createDate;

	
	public String getOperationCode() {
		return operationCode;
	}

	public void setOperationCode(String operationCode) {
		this.operationCode = operationCode;
	}

	public String getAppUuid() {
		return appUuid;
	}

	public void setAppUuid(String appUuid) {
		this.appUuid = appUuid;
	}

	public String getOperationName() {
		return operationName;
	}

	public void setOperationName(String operationName) {
		this.operationName = operationName;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	
	public Operation toOperation() {
		Operation result = new Operation();
		
		result.setOperationCode(operationCode);
		result.setOperationName(operationName);
		result.setOwned(new Integer(0));
		return result;
	}

	@Override
	public String toString() {
		StringBuffer result = new StringBuffer();
		
		result.append(getClass().getName())
			.append(": operationCode='").append(operationCode).append("'")
			.append(", appUuid='").append(appUuid).append("'")
			.append(", operationName='").append(operationName).append("'")
			.append(", createDate=").append(createDate)
			;
		
		return result.toString();
	}
}
